package com.yangyu.controller;

import com.yangyu.message.BaseRsp;
import com.yangyu.pojo.Like;
import com.yangyu.service.LikeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 一碗鱼汤面
 * @version V1.0
 * @Package com.yangyu.controller
 * @date 2020/12/20 21:43
 */
@Api(tags = "点赞模块")
@RestController
@RequestMapping("/like")
public class LikeController {

    @Autowired
    private LikeService likeService;

    @ApiOperation("点赞")
    @PostMapping("/addLike")
    public BaseRsp addLike(@RequestBody Like like) {
        return likeService.addLike(like);
    }

    @ApiOperation("取消点赞")
    @DeleteMapping("/cancelLike")
    public BaseRsp cancelLike(@RequestBody Like like) {
        return likeService.cancelLike(like);
    }

    @ApiOperation("查询点赞")
    @PostMapping("/getLike")
    public BaseRsp getLike(@RequestBody Like like) {
        return likeService.getLike(like);
    }
}
